import type { GetCodeData, GetCodeParams, LoginCodeData, LoginCodeParams, UserData } from '@/types/user'
import { request } from '@/utils/request'

/**
 * 发送验证码
 */
export const getCodeApi = (params: GetCodeParams) => {
  // get 方法的参数需要通过 params 来传递
  return request.get<null, GetCodeData>('/code', { params })
}

export const loginByMobileApi = (data: LoginCodeParams) => {
  return request.post<null, LoginCodeData>('/login', data)
}

/**
 * 获取登录用户的个人信息
 */
export const userInfoApi = () => {
  return request.get<null, UserData>('/patient/myUser')
}